package kernel_gui.interfaces.kernel_gui;

import common.entities.enums.PATTERN;

public interface IManageQuestions {


	/**
	 * Creates a question
	 * <br><br>
	 * <b>On Success</b> - will call gui's returnAnswer with Boolean value 'true'
	 * <br>
	 * <b>On fail</b> - will call gui's returnError with the right error message
	 * <br>
	 * @param action - CREATE
	 * @param pattern - a question pattern 
	 * @param entityIdQ - the entity id that completes the question (for example movie_id)
	 * if the question is about a movie enter the movie year
	 * @param requestId
	 */
	void createQuestion(PATTERN pattern, int entityIdQ, int requestId);
	
	
	/**
	 * Counts how many question records in the DB match wanted query
	 * 
	 * <br><br>
	 * <b>On Success</b> - will call gui's returnAnswer with Integer value holding number of records
	 * <br>
	 * <b>On fail</b> - will call gui's returnError with the right error message
	 * <br>
	 * @param pattern - the pattern of the question
	 * @param entityIdQ - the entity id that completes the question
	 *  
	 */
	void countAnswers(PATTERN pattern, int entityIdQ ,int requestId);
	
	
	
	/**
	 * Gets the set of answers from DB that match the question created (with pattern and id)
	 * <br><br>
	 * <b>On Success</b> - will call gui's returnAnswer with List that match wanted query (no matches is counted as success - empty list)
	 * <br>
	 * <b>On fail</b> - will call gui's returnError with the right error message
	 * <br>
	 * @param pattern - the pattern of the question
	 * @param entityIdQ - the entity id that completes the question
	 * @param from - starting from 0, 
	 * @param to - not including! (the item at 'to' index);
	 */
	void getAnswers(PATTERN pattern, int entityIdQ,int from, int to, int requestId);
	
	/**
	 * sets the users answer to the question just created - 
	 * <br><br>
	 * <b>On Success</b> - will call gui's returnAnswer with Boolean value 'true'
	 * <br>
	 * <b>On fail</b> - will call gui's returnError with the right error message
	 * <br>
	 * @param entityIdQ - the entity id of the question selected (for example the movie id)
	 * @param entityIdA - the entity id of the answer selected  (for example the actor id)
	 * @param QLevel - an integer stating the question level, 1=easy, 2=medium, 3=hard
	 * @param requestId
	 */
	void setRightAnswer(PATTERN pattern, int entityIdQ, int entityIdA, int QLevel, int requestId);
	
	
	/**
	 * deleted a question
	 * <br><br>
	 * <b>On Success</b> - will call gui's with true value
	 * <br>
	 * <b>On fail</b> - will call gui's returnError with the right error message
	 * <br>
	 * @param pattern - a question pattern 
	 * @param questionId - the question id we want to delete from pattern (DBQuestion id)
	 * @param requestId
	 */
	void deleteQuestion(PATTERN pattern, int questionID, int requestId);

	
	/**
	 * search a question that movie is part of the question
	 * <b>On Success</b> - will call gui with list of DBQuestion
	 * <br>
	 * <b>On fail</b> - will call gui's returnError with the right error message
	 * <br>
	 * @param pattern - a question pattern 
	 * @param titleSubStr -  null if not used, a string otherwise
	 * @param from - starting from 0, 
	 * @param to - not including! (the item at 'to' index);
	 * */
	void searchQuestionMovie(PATTERN pattern,String titleSubStr,int from, int to, int requestId);
	
	/**
	 * Counts how many question records in the DB match wanted query
	 * 
	 * <br><br>
	 * <b>On Success</b> - will call gui's returnAnswer with Integer value holding number of records
	 * <br>
	 * <b>On fail</b> - will call gui's returnError with the right error message
	 * <br>
	 * @param pattern - the pattern of the question
	 * @param entityIdQ - the entity id that completes the question
	 *  
	 */
	void countQuestionMovie(PATTERN pattern,String titleSubStr,int requestId);
	
	/**
	 * search a question that a person entity is part of the question 
	 * (for question about actor/director)
	 * <b>On Success</b> - will call gui with list of DBQuestion
	 * <br>
	 * <b>On fail</b> - will call gui's returnError with the right error message
	 * <br>
	 * 
	 * @param pattern - a question pattern 
	 * @param firstNameSubStr - substring of the first name
	 * @param lastNameSubStr -  substring of the last name
	 * @param from
	 * @param to
	 * @param requestId
	 * */
	void searchQuestioPerson(PATTERN pattern,String firstNameSubStr, 
			String lastNameSubStr, int from, int to,int requestId);
	
	
	/**
	 * Counts how many question records in the DB match wanted query
	 * 
	 * <br><br>
	 * <b>On Success</b> - will call gui's returnAnswer with Integer value holding number of records
	 * <br>
	 * <b>On fail</b> - will call gui's returnError with the right error message
	 * <br>
	 * @param pattern - the pattern of the question
	 * @param entityIdQ - the entity id that completes the question
	 *  
	 */
	void countQuestioPerson(PATTERN pattern,String firstNameSubStr, 
			String lastNameSubStr, int requestId);
	
	
	/**
	 * search a question that a year is part of the question 
	 * (for question about actor/director)
	 * <b>On Success</b> - will call gui with list of DBQuestion
	 * <br>
	 * <b>On fail</b> - will call gui's returnError with the right error message
	 * <br>
	 * 
	 * @param pattern - a question pattern 
	 * @param minYear - the min year (if the user does not enter it please enter -1)
	 * @param maxYear - the max year (if the user does not enter it please enter -1)
	 * @param from
	 * @param to
	 * @param requestId
	 * */
	void searchQuestioYear(PATTERN pattern,int minYear, 
			int maxYear, int from, int to,int requestId);
	
	
	/**
	 * Counts how many question records in the DB match wanted query
	 * 
	 * <br><br>
	 * <b>On Success</b> - will call gui's returnAnswer with Integer value holding number of records
	 * <br>
	 * <b>On fail</b> - will call gui's returnError with the right error message
	 * <br>
	 * @param pattern - the pattern of the question
	 * @param entityIdQ - the entity id that completes the question
	 *  
	 */
	void countQuestioYear(PATTERN pattern,int minYear, 
			int maxYear, int requestId);
	
	
}
